<template>
    <div
		class="home-aside"
        :style="{ width: asideWidth + 'px', 'border-right': '1px solid #d7cbcb' }"
    >
        <el-menu
            ref="elMenu"
            @open="handleOpen"
            @close="handleClose"
            :default-active="$route.path"
            :router="true"
        >
            <menu-left
                v-for="item in $store.state.user.routeList"
                :key="item.name"
                @saveInfo="saveInfo"
                :childrenArr="item"
            />
        </el-menu>
    </div>
</template>
<script>
import menuLeft from './menuLeft.vue'

export default {
    name: 'homeAside',
    components: { menuLeft },
    mounted(){

    },  
    data() {
        return {
            asideWidth: 200,
            textInfo: '',
            textInfoFlag: false,
            textInfoTop: 0,
        }
    },
    methods: {
        handleOpen(key, keyPath) {
            // console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            // console.log(key, keyPath);
        },
        // 设置菜单信息
        saveInfo(info) {
            if (info.path == 'file') return
            let obj = {
                title: info.name,
                name: info.name,
                path:  info.path,
            }
			this.$store.commit('homeStore/setRouterInfo', obj);
			this.$store.commit('homeStore/setEditableTabsValue', info.name);
        },
    },
}
</script>
<style lang="scss" scoped>
::v-deep .el-menu { 
    height: calc(100% - 30px);
    width: 200px;
    background: white;

}

::v-deep .el-menu-item,
::v-deep .el-submenu__title {
    height: 45px;
    line-height: 45px;
    font-size: 14px;
    padding: 0 35px;
    // min-width: 0;
    transition: all 0.1s;
    font-weight: 700;
}

::v-deep .el-menu-item.is-active {
    background: #ecf5ff;
	border-radius: 4px;
    color: #409eff;
    // border-right: 3px solid $themeBackground;
}
.home-aside {
    position: relative;
    background: white;
    color: #333;
    height: calc(100%);
    // height: 100%;
    transition: width 0.1s;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-touch-callout: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -ms-user-select: none;
    user-select: none;

    &::-webkit-scrollbar {
        width: 5px !important;
    }
    &-line {
        position: absolute;
        right: 0;
        width: 8px;
        height: 100%;
        background: transparent;
        z-index: 3;
        cursor: col-resize;
    }
}
.text-info {
    position: absolute;
    right: 40px;
    width: 150px;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
    color: white;
    background: #409eff;
    border-radius: 4px;
    z-index: 999;
}
.div-is-open {
    height: 30px;
    position: relative;
    background: white;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 7px 0 rgba(0, 0, 0, 0.096);
}

.cp-open {
    position: absolute;
    font-size: 24px;
    color: #409eff;
    cursor: pointer;
    top: 50%;
    transform: translate(0, -50%);
}
.left {
    left: 20px;
}
.right {
    right: 5px;
}
</style>
